{__NOLAYOUT__}
<html><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>小学教师赠品《小学生绘本课堂·教案》纸质版领取</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/queren.css" />
    <script type="text/javascript" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/layer_mobile/layer.js"></script>
    <link rel="stylesheet" type="text/css" href="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/layer.css" />
    <script src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/jquery.1.9.1.js"></script>
    <script type="text/javascript" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/rem.js"></script>
    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script type="text/javascript" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.css" />
</head>
<style>
    .dotm_btn1{background-color: #4876b2;}
    .huoqu{background-color: #4876b2;border-radius: 0!important;}
    .layui-m-layer-msg .layui-m-layercont{color: #fff;}
    textarea{resize: none;border: 1px solid #ccc;width: 98%;height: 1.3rem;appearance: none;-webkit-appearance: none;border-radius: 0;padding: 5px;}
    select#banben{width: 98%!important;color: #666!important;}
    .addressmone ul li input{height: 25px!important;line-height: 25px!important;padding: 0.35rem 0;color: #666;}
    .addressmone ul li span{color: #000;}
    .addressmone ul li input[type='radio']{
        display: none!important;
    }
    label{
        position: relative;
    }
    label::before{
        display: inline-block;
        content: "";
        width: 0.32rem;
        height: 0.32rem;
        background: url(http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/nochecked.png) no-repeat;
        background-size: 100% 100%;
        margin-right: 6px;
        vertical-align: bottom;
        float: left;
        margin-top: 0.2rem;
        margin-left: 0.2rem;
    }
    input[type='radio']:checked+label::before{
        background: url(http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/checked.png) no-repeat;
        background-size: 100% 100%;
        float: left;
        margin-top: 0.2rem;
        margin-left: 0.2rem;
    }
    input[type='radio']:checked+label::after{
        display: inline-block;
        content: "";
        background: url(http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/checked.png) no-repeat;
        background-size: 100% 100%;
    }
</style>
<body class="body_tj">
<div id="tbh5v0">
    <div class="addressmone">
        <ul>
            <li>
                <span>姓名</span><em><input type="text" name="consignee" value="" id="name" ></em>
            </li>
            <li>
                <span>手机号码</span><em><input style="width: 98%;height: 0.7rem;" type="number" pattern="[0-9]*" name="" id="tel" value="" /></em>
            </li>
            <li style="position: relative;">
                <span>验证码</span>
                <em><input style="width: 50%;height: 0.7rem;" type="number" name="" id="code" pattern="[0-9]*" value="" />
                    <div class="huoqu">获取验证码</div></em>
            </li>
            <li>
                <span>所在地区</span>
                <div id="trigger4" class="trigger4" style="text-indent:0.5em;display: inline-block;border: 1px solid #ccc;width: 73%;height: 35px;line-height: 35px;margin-left: 0.2rem;font-size: 12px;">
                    <span style="font-size: 12px;color: #666;">请选择</span>
                </div>
                <input type="hidden" name="" id="sheng" value="" />
                <input type="hidden" name="" id="shi" value="" />
                <input type="hidden" name="" id="xian" value="" />
            </li>
            <li>
                <span>邮寄地址</span><em> <textarea name="address" id="address_"></textarea></em>
            </li>
            <li>
                <span>所在学校</span><em> <input type="text" id="school" name="school"  value=""  /></em>
            </li>
            <li>
                <span>学制</span>
                <input class="type" type="radio" name="xuezhi" id="liusan" value="六三制" checked />
                <label for="liusan"><span>六三制</span></label>
                <input class="type" type="radio" name="xuezhi" id="wusi" value="五四制"  />
                <label for="wusi"><span>五四制</span></label>
            </li>
            <li>
                <span>所授年级</span>
                <em>
                    <select id="banben" value="">
                        <option value="0">请选择</option>
                        <option value="1">一年级 (该产品已赠完)</option>
                        <option value="2">二年级 (该产品已赠完)</option>
                        <option value="三年级">三年级</option>
                        <option value="四年级">四年级</option>
                        <option value="五年级">五年级</option>
                        <option value="六年级">六年级</option>
                    </select>
                </em>
            </li>
        </ul>

        <div class="dotm_btn">
            <input type="submit" value="提交" class="dotm_btn1">
        </div>

    </div>
</div>
<script>
  $(function(){

    $('.type').click(function (event) {
      var html = '';
      $("#banben").html('');
        if(this.value == '六三制')
        {
          html +="<option value=\"0\">请选择</option>\n" +
            "                        <option value=\"1\">一年级 (该产品已赠完)</option>\n" +
            "                        <option value=\"2\">二年级 (该产品已赠完)</option>\n" +
            "                        <option value=\"三年级\">三年级</option>\n" +
            "                        <option value=\"四年级\">四年级</option>\n" +
            "                        <option value=\"五年级\">五年级</option>\n" +
            "                        <option value=\"六年级\">六年级</option>";
          console.log(this.value);
        }else{
          console.log(this.value+'2222');
          html +="<option value=\"0\">请选择</option>\n" +
            "                        <option value=\"一年级\">一年级</option>\n" +
            "                        <option value=\"二年级\">二年级</option>\n" +
            "                        <option value=\"三年级\">三年级</option>\n" +
            "                        <option value=\"四年级\">四年级</option>\n" +
            "                        <option value=\"五年级\">五年级</option>";
        }
      $("#banben").prepend(html); //为Select插入一个Option(第一个位置)
    });

    var mobileSelect4 = new MobileSelect({
      trigger: '#trigger4',
      title: '地区选择',
      wheels: [{data:[
          {
            id:'1',
            value:'',
            childs:[
              {id:'A1',value:''},
            ]
          }
        ]}],
      transitionEnd:function(indexArr, data){

      },
      callback:function(indexArr, data){
        console.log(data);
        $('#sheng').val(data[0].id);
        $('#shi').val(data[1].id);
        $('#xian').val(data[2].id);
      }
    });
    $.ajax({
      type: "get",
      url: "http://oa.fc62.com/api/ajax/area",
      dataType: "json",
      success: function(res){
        mobileSelect4.updateWheels(res.data);
      }
    });
    $('.huoqu').click(function() {
      var tel = $('#tel').val();
      if(!(/^1[3456789]\d{9}$/.test(tel))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      $.ajax({
        type: 'get',
        url:"/api/teachers/tel/tel/"+tel ,
        success: function(data){
          if(data.code == 0) {
            layer.open({
              content: data.msg,
              skin: 'msg',
              time: 2 //2秒后自动关闭
            });
            return false
          }else{
            $.ajax({
              type: 'post',
              url:"/api/sms/send" ,
              data:{mobile:tel,action:'default'},
              success: function(data){
                console.log(data);
                if(data.code != 1){
                  layer.open({
                    content:data.msg ,
                    skin: 'msg',
                    time: 2 //2秒后自动关闭
                  });
                  return false
                }else{
                  var count = 120;
                  const countDown = setInterval(() => {
                    if (count === 0) {
                      $('.huoqu').text('重新发送').removeAttr('disabled');
                      $('.huoqu').css({
                        background: '#f3494c',
                        color: '#fff',
                      });
                      clearInterval(countDown);
                    } else {
                      $('.huoqu').attr('disabled', true);
                      $('.huoqu').css({
                        background: '#eee',
                        color: '#333',
                      });
                      $('.huoqu').text(count + '秒后可重新获取');
                    }
                    count--;
                  }, 1000);
                }
              }
            });
          }
        }
      });

    });
    $('.dotm_btn1').click(function(){
      var name = $('#name').val();
      var address = $('#address_').val();
      var tel = $('#tel').val();
      var code = $('#code').val();
      var sheng = $('#sheng').val();
      var shi = $('#shi').val();
      var xian = $('#xian').val();
      var banben = $('#banben').val();
      var school = $('#school').val();
      var type = $('.type').val();
      if(name == ""||name == null){
        layer.open({
          content: '请填写姓名',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }

      if(!(/^1[3456789]\d{9}$/.test(tel))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(code == ""||code == null){
        layer.open({
          content: '请填写验证码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(sheng == ""||sheng == null){
        layer.open({
          content: '请选择所在地区',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(address == ""||address == null){
        layer.open({
          content: '请填写详细地址',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(school == ""||school == null)
      {
        layer.open({
          content: '请填写所在学校',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(banben == 0){
        layer.open({
          content: '请选择所授年级',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(banben == "1" || banben =="2"){
        layer.open({
          content: '该产品已赠完,请重新选择。',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      //验证验证码
      $.ajax({
        type: 'post',
        url:"/api/sms/check" ,
        data:{mobile:tel,captcha:code},
        success: function(data){
          if(data.code == 0){
            layer.open({
              content: data.msg,
              skin: 'msg',
              time: 2,
            });
            return false;
          }else{
            $.ajax({
              type: 'post',
              url:"/api/teachers/index" ,
              data:{name:name,phone:tel,address:address,shen:sheng,shi:shi,xian:xian,version:banben,type:type,school:school},
              success: function(data){
                if(data.code == 0) {
                  layer.open({
                    content: data.msg,
                    skin: 'msg',
                    time: 2,
                  });
                  return false;
                }
                window.location.href="http://tmall.fc62.com/hblq_success.html";
              }
            });
          }
        }
      });


    });
  });




</script>
</body>

</html>